﻿<Windows:ResourceDictionary xmlns:Windows="clr-namespace:System.Windows;assembly=PresentationFramework" xmlns:Controls="clr-namespace:Microsoft.Surface.Presentation.Controls;assembly=Microsoft.Surface.Presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mspg="clr-namespace:Microsoft.Surface.Presentation.Generic;assembly=Microsoft.Surface.Presentation.Generic">
    <Style x:Key="SurfaceButtonStyle" TargetType="{x:Type Controls:SurfaceButton}" >
    <Style.BasedOn>
        <Style TargetType="{x:Type ButtonBase}">
            <Style.Resources>
                <ResourceDictionary />
            </Style.Resources>
            <Setter Property="MinWidth" Value="48"/>
            <Setter Property="MinHeight" Value="48"/>   
            <Setter Property="UIElement.SnapsToDevicePixels">
                <Setter.Value>
                    <s:Boolean>
                        True</s:Boolean>
                </Setter.Value>
            </Setter>
            <Setter Property="FrameworkElement.FocusVisualStyle">
                <Setter.Value>
                    <Style TargetType="{x:Type IFrameworkInputElement}">
                        <Style.Resources>
                            <ResourceDictionary />
                        </Style.Resources>
                        <Setter Property="Control.Template">
                            <Setter.Value>
                                <ControlTemplate />
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Setter.Value>
            </Setter>
            <Setter Property="TextElement.FontFamily">
                <Setter.Value>
                    <FontFamily>
                        Segoe UI</FontFamily>
                </Setter.Value>
            </Setter>
            <Setter Property="TextElement.FontSize">
                <Setter.Value>
                    <s:Double>
                        10</s:Double>
                </Setter.Value>
            </Setter>
            <Setter Property="TextElement.Foreground">
                <Setter.Value>
                    <SolidColorBrush>
                        #FF000000</SolidColorBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Panel.Background">
                <Setter.Value>
                    <SolidColorBrush>
                        #33A4B4BD</SolidColorBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Border.BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <LinearGradientBrush.GradientStops>
                            <GradientStop Color="#7FFFFFFF" Offset="0" />
                            <GradientStop Color="#0CFFFFFF" Offset="1" />
                        </LinearGradientBrush.GradientStops>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Border.BorderThickness">
                <Setter.Value>
                    <Thickness>
                        1,1,1,1</Thickness>
                </Setter.Value>
            </Setter>
            <Setter Property="Control.HorizontalContentAlignment">
                <Setter.Value>
                    <x:Static Member="HorizontalAlignment.Center" />
                </Setter.Value>
            </Setter>
            <Setter Property="Control.VerticalContentAlignment">
                <Setter.Value>
                    <x:Static Member="VerticalAlignment.Center" />
                </Setter.Value>
            </Setter>
            <Setter Property="Control.Padding">
                <Setter.Value>
                    <Thickness>
                        15,6,15,6</Thickness>
                </Setter.Value>
            </Setter>
            <Setter Property="KeyboardNavigation.IsTabStop">
                <Setter.Value>
                    <s:Boolean>
                        False</s:Boolean>
                </Setter.Value>
            </Setter>
            <Setter Property="UIElement.Focusable">
                <Setter.Value>
                    <s:Boolean>
                        False</s:Boolean>
                </Setter.Value>
            </Setter>
            <Setter Property="FrameworkElement.MinWidth">
                <Setter.Value>
                    <s:Double>
                        30</s:Double>
                </Setter.Value>
            </Setter>
            <Setter Property="FrameworkElement.MinHeight">
                <Setter.Value>
                    <s:Double>
                        30</s:Double>
                </Setter.Value>
            </Setter>
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ButtonBase}">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="Press">
                                <Storyboard.Children>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <DoubleAnimationUsingKeyFrames.KeyFrames>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1" />
                                        </DoubleAnimationUsingKeyFrames.KeyFrames>
                                    </DoubleAnimationUsingKeyFrames>
                                    <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                        <ThicknessAnimationUsingKeyFrames.KeyFrames>
                                            <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-3,-3,-3,-3" />
                                        </ThicknessAnimationUsingKeyFrames.KeyFrames>
                                    </ThicknessAnimationUsingKeyFrames>
                                </Storyboard.Children>
                            </Storyboard>
                            <Storyboard x:Key="Release">
                                <Storyboard.Children>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <DoubleAnimationUsingKeyFrames.KeyFrames>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
                                            <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0" />
                                        </DoubleAnimationUsingKeyFrames.KeyFrames>
                                    </DoubleAnimationUsingKeyFrames>
                                    <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                        <ThicknessAnimationUsingKeyFrames.KeyFrames>
                                            <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-3,-3,-3,-3" />
                                            <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="1,1,1,1" />
                                        </ThicknessAnimationUsingKeyFrames.KeyFrames>
                                    </ThicknessAnimationUsingKeyFrames>
                                </Storyboard.Children>
                            </Storyboard>
                        </ControlTemplate.Resources>
                          <Grid Name="Grid" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" RenderTransformOrigin="0.5,0.5">
                            <Border BorderThickness="0,0,0,1" Padding="1,1,1,1" CornerRadius="6,6,6,6" BorderBrush="#33000000" Name="Shadow" Margin="1,1,1,0" />
                            <Rectangle RadiusX="5" RadiusY="5" Fill="{TemplateBinding Panel.Background}" StrokeThickness="1" Name="Base" Margin="1,1,1,1" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}">
                                <Rectangle.Stroke>
                                    <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#66000000" Offset="0" />
                                            <GradientStop Color="#33000000" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Rectangle.Stroke>
                            </Rectangle>
                            <Rectangle RadiusX="4" RadiusY="4" Stroke="{TemplateBinding Border.BorderBrush}" StrokeThickness="1" Name="RenderOverlay" Margin="2,2,2,2" Opacity="1" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}">
                                <Rectangle.Fill>
                                    <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#26000000" Offset="0" />
                                            <GradientStop Color="#4CFFFFFF" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <mspg:SurfaceShadowChrome Color="#FFFFFFFF" CornerRadius="4,4,4,4" Name="Glow" Margin="1,1,1,1" Opacity="0" />
                            <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" Name="Content" Margin="{TemplateBinding Control.Padding}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}">
                                <ContentPresenter.RenderTransform>
                                    <TranslateTransform X="0" Y="-1" />
                                </ContentPresenter.RenderTransform>
                            </ContentPresenter>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="ButtonBase.IsPressed">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <Storyboard.Children>
                                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                                        <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1" />
                                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                                </DoubleAnimationUsingKeyFrames>
                                                <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                                    <ThicknessAnimationUsingKeyFrames.KeyFrames>
                                                        <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-3,-3,-3,-3" />
                                                    </ThicknessAnimationUsingKeyFrames.KeyFrames>
                                                </ThicknessAnimationUsingKeyFrames>
                                            </Storyboard.Children>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <Storyboard.Children>
                                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <DoubleAnimationUsingKeyFrames.KeyFrames>
                                                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
                                                        <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0" />
                                                    </DoubleAnimationUsingKeyFrames.KeyFrames>
                                                </DoubleAnimationUsingKeyFrames>
                                                <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                                    <ThicknessAnimationUsingKeyFrames.KeyFrames>
                                                        <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-3,-3,-3,-3" />
                                                        <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="1,1,1,1" />
                                                    </ThicknessAnimationUsingKeyFrames.KeyFrames>
                                                </ThicknessAnimationUsingKeyFrames>
                                            </Storyboard.Children>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.ExitActions>
                                <Trigger.Value>
                                    <s:Boolean>
                                        True</s:Boolean>
                                </Trigger.Value>                                
                            </Trigger>
                            <Trigger Property="UIElement.IsEnabled">
                                <Trigger.Value>
                                    <s:Boolean>
                                        True</s:Boolean>
                                </Trigger.Value>
                            </Trigger>
                            
                            <Trigger Property="UIElement.IsEnabled">
                              
                                <Setter Property="Shape.Fill" TargetName="RenderOverlay">
                                    <Setter.Value>
                                        <SolidColorBrush>
                                            #0CFFFFFF</SolidColorBrush>
                                    </Setter.Value>
                                </Setter>
                           
                                <Setter Property="Shape.Stroke" TargetName="RenderOverlay">
                                    <Setter.Value>
                                        <SolidColorBrush>
                                            #33FFFFFF</SolidColorBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Shape.Stroke" TargetName="Base">
                                    <Setter.Value>
                                        <SolidColorBrush>
                                            #33000000</SolidColorBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Border.BorderBrush" TargetName="Shadow">
                                    <Setter.Value>
                                        <SolidColorBrush>
                                            #00000000</SolidColorBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="TextElement.Foreground">
                                    <Setter.Value>
                                        <SolidColorBrush>
                                            #A5333333</SolidColorBrush>
                                    </Setter.Value>
                                </Setter>
                             
                                <Setter Property="Panel.Background">
                                    <Setter.Value>
                                        <SolidColorBrush>
                                            #00FFFFFF</SolidColorBrush>
                                    </Setter.Value>
                                </Setter>
                                <Trigger.Value>
                                    <s:Boolean>
                                        False</s:Boolean>
                                </Trigger.Value>

                            </Trigger>
                            <Trigger Property="AreAnyTouchesOver" Value="True">
                                <Setter Property="Opacity" Value="0.7"/>
                                <Setter Property="RenderTransform" TargetName="Grid">
                                    <Setter.Value>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="0.9" ScaleY="0.9"/>
                                            <SkewTransform/>
                                            <RotateTransform/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Style.BasedOn>
    <Style.Resources>
        <ResourceDictionary />
    </Style.Resources>
</Style>

    <!--
    <Style TargetType="{x:Type Controls:SurfaceButton}" BasedOn="{StaticResource SurfaceButtonStyle}" />
    -->
</Windows:ResourceDictionary>